using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data;

namespace DataAccessLayer
{
    public class Search
    {
        private string category;
        private string keyword;
        private string connstring;
        public string CATEGORY
        {
            get { return category; }
            set { category = value; }
        }
        public string KEYWORD
        {
            get { return keyword; }
            set { keyword = value; }
        }

         public Search(string connstring)
        {
             this.connstring = connstring;
        }

        public DataTable details()
        {
            SqlDataReader s1 = null;
            SqlConnection con = new SqlConnection(connstring);
            con.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "sp_disease_details";
            cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.Add(new SqlParameter("@category", category));
            cmd.Parameters.Add(new SqlParameter("@keyword", keyword));
            s1 = cmd.ExecuteReader();
            DataTable dtDisplay = new DataTable();
            dtDisplay.Load(s1);
            con.Close();
            return dtDisplay;
        }
        
        public DataTable medicineDetails()
        {
            SqlDataReader s1 = null;
            SqlConnection con = new SqlConnection(connstring);
            con.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "sp_medicine_details";
            cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.Add(new SqlParameter("@category", category));
            cmd.Parameters.Add(new SqlParameter("@keyword", keyword));
            s1 = cmd.ExecuteReader();
            DataTable dtDisplay = new DataTable();
            dtDisplay.Load(s1);
            con.Close();
            return dtDisplay;
        }
        public DataTable symptomsDetails()
        {
            SqlDataReader s1 = null;
            SqlConnection con = new SqlConnection(connstring);
            con.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "sp_symptoms_details";
            cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.Add(new SqlParameter("@category", category));
            cmd.Parameters.Add(new SqlParameter("@keyword", keyword));
            s1 = cmd.ExecuteReader();
            DataTable dtDisplay = new DataTable();
            dtDisplay.Load(s1);
            con.Close();
            return dtDisplay;
        }
        public DataTable doctorDetails()
        {
            SqlDataReader s1 = null;
            SqlConnection con = new SqlConnection(connstring);
            con.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "sp_doctor_details";
            cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.Add(new SqlParameter("@category", category));
            cmd.Parameters.Add(new SqlParameter("@keyword", keyword));
            s1 = cmd.ExecuteReader();
            DataTable dtDisplay = new DataTable();
            dtDisplay.Load(s1);
            con.Close();
            return dtDisplay;
        }
    }
}